package com.bingwang.sourcelearn.beans.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author WangBing
 * @date 2024/5/12 22:20
 */
public class SystemCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String property = context.getEnvironment().getProperty("os.name").toLowerCase();
        System.out.println("property: " + property);
        return property.contains("mac");
    }
}
